package com.zzyl.dto;

import com.zzyl.base.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Objects;

/**
 * 角色表
 */
@Data
@NoArgsConstructor
@ApiModel("角色DTO")
public class RoleDto extends BaseDto implements Serializable {
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        RoleDto roleDto = (RoleDto) o;
        return Objects.equals(roleName, roleDto.roleName) && Objects.equals(label, roleDto.label) && Objects.equals(sortNo, roleDto.sortNo) && Objects.equals(remark, roleDto.remark) && Objects.equals(userId, roleDto.userId) && Objects.equals(dataScope, roleDto.dataScope) && Objects.equals(dataState, roleDto.dataState) && Arrays.equals(checkedResourceNos, roleDto.checkedResourceNos) && Arrays.equals(checkedDeptNos, roleDto.checkedDeptNos) && Objects.equals(pageNum, roleDto.pageNum) && Objects.equals(pageSize, roleDto.pageSize);
    }

    @Override
    public int hashCode() {
        int result = Objects.hash(super.hashCode(), roleName, label, sortNo, remark, userId, dataScope, dataState, pageNum, pageSize);
        result = 31 * result + Arrays.hashCode(checkedResourceNos);
        result = 31 * result + Arrays.hashCode(checkedDeptNos);
        return result;
    }

    @ApiModelProperty(value = "角色名称")
    private String roleName;

    @ApiModelProperty(value = "角色标识")
    private String label;

    @ApiModelProperty(value = "排序")
    private Integer sortNo;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "人员查询部门：当前人员Id")
    private String userId;

    @ApiModelProperty(value = "数据范围（0自定义  1本人 2本部门及以下 3本部门 4全部）")
    private String dataScope;

    @ApiModelProperty(value = "是否启用（0:启用，1:禁用）")
    private String dataState;

    @ApiModelProperty(value = "TREE结构：选中资源No")
    private String[] checkedResourceNos;

    @ApiModelProperty(value = "TREE结构：选中部门No")
    private String[] checkedDeptNos;

    private Integer pageNum;

    private Integer pageSize;

    @Builder
    public RoleDto(String roleName, String label, Integer sortNo, String remark, String userId, String dataScope, String dataState, String[] checkedResourceNos, String[] checkedDeptNos) {
        this.roleName = roleName;
        this.label = label;
        this.sortNo = sortNo;
        this.remark = remark;
        this.userId = userId;
        this.dataScope = dataScope;
        this.dataState = dataState;
        this.checkedResourceNos = checkedResourceNos;
        this.checkedDeptNos = checkedDeptNos;
    }
}
